package com.kornero.auto.util.email;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Email {

    private static final Logger logger = LoggerFactory.getLogger(Email.class);

    private final String smtpUserName;
    private final String smtpUserPass;

    public Email(String smtpUserName, String smtpUserPass) {
        this.smtpUserName = smtpUserName;
        this.smtpUserPass = smtpUserPass;
    }

    public String getSmtpUserName() {
        return smtpUserName;
    }

    public String getSmtpUserPass() {
        return smtpUserPass;
    }

    @Override
    public boolean equals(final Object anObject) {
        if (this == anObject) {
            return true;
        }
        if (anObject instanceof Email) {
            final Email that = (Email) anObject;
            return this.getSmtpUserName().equals(that.getSmtpUserName())
                    && this.getSmtpUserPass().equals(that.getSmtpUserPass());
        }
        return false;
    }

    @Override
    public int hashCode() {
        return 31 * this.getSmtpUserName().hashCode()
                + this.getSmtpUserPass().hashCode();
    }

    @Override
    public String toString() {
        return "Email: user = " + this.getSmtpUserName() + ", pass = " + this.getSmtpUserPass();
    }
}
